package com.dzsw.netty.tcp;

import com.google.common.base.Joiner;

public class NettyPoolAraneTest {

    public static void main(String[] args) {
        Joiner joiner = Joiner.on(",");
        int maxSubpageAllocs = 2048;
        Byte[] memoryMap = new Byte[maxSubpageAllocs << 1];
        Byte[] depthMap = new Byte[memoryMap.length];
        memoryMap[0] = 0;
        depthMap[0] = 0;
        int memoryMapIndex = 1;
        int maxOrder = 11;

        for (int d = 0; d <=maxOrder; ++d) {
            int depth = 1 << d; // 0 2 4 8 16 ... 2048
            for (int p = 0; p < depth; ++p) {
                memoryMap[memoryMapIndex] = (byte) d;
                depthMap[memoryMapIndex] = (byte) d;
                memoryMapIndex++;
            }
        }
        System.out.println(joiner.join(new Byte[]{1,3,5}));
        System.out.println(joiner.join(memoryMap));
        System.out.println(joiner.join(depthMap));
    }
}
